﻿#pragma once

#include "resource.h"
#include "McRebarDetailData.h"

// CDlgRebarCustom 对话框

class CDlgRebarCustom : public CDialogEx
{
	DECLARE_DYNAMIC(CDlgRebarCustom)

public:
	CDlgRebarCustom(CWnd* pParent = nullptr);   // 标准构造函数
	virtual ~CDlgRebarCustom();

// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_DIALOG_REBAR_CUSTOM };
#endif

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	LRESULT OnAcadKeepFocus(WPARAM, LPARAM);

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedButtonDrawLine();
	afx_msg void OnBnClickedButtonDrawArc();
	afx_msg void OnBnClickedButtonDrawCircle();
	afx_msg void OnBnClickedButtonDrawPolyline();

	void AddVertex(McRebarDetailGraphPolyLine* pMcGraphPolyLine, const AcGePoint3d& pointNext, const AcGePoint3d& pointStart, const AcGeCircArc3d& arc, double bulge, const AcDbObjectId& eId);
	afx_msg void OnBnClickedOk();

	void Save(const McRebarDetailData& data);
	void Clear();

	static CDlgRebarCustom* GetInstance();

private:
	CEdit m_rebarCode;

	/// <summary>
	/// 图形实体id到图形数据的map
	/// </summary>
	std::map<AcDbObjectId, McRebarDetailGraphBase*> m_graphIdMap;
	/// <summary>
	/// 标注实体id到表达式的map
	/// </summary>
	std::map<AcDbObjectId, McRebarDetailExpr*> m_dimIdExprMap;

	AcGePoint3d m_basePoint;

	static CDlgRebarCustom* s_instance;
public:
	afx_msg void OnBnClickedButtonSetBase();
	afx_msg void OnBnClickedButtonPickPolyline();
	afx_msg void OnClose();
};
